<?php

	function db_my_role()
	{
		$my_role = array(
			'Select Role'    => 'Select Role',
			'Tours'			 => 'Tours',
			'Hotels'		 => 'Hotels',
			'Tickets'		=> 'Tickets',
			'Visas'			=> 'Visas',
			'Travel Agent'	=> 'Travel Agent'
		);
		return $my_role;
	}
	
	function fb_add_custom_user_profile_fields( $user ) {
    ?>
    <h3><?php _e('Extra Profile Information', 'your_textdomain'); ?></h3>
    <table class="form-table">
    <tr>
    <th>
    <label for="address"><?php _e('My Add user Permission', 'your_textdomain'); ?>
    </label></th>
    <td>
    <?php
    $my_role = db_my_role(); 
    $usermeta = get_the_author_meta( 'add_user_role', $user->ID );    
    ?>
    <select name="add_user_role" id="add_user_role">
    	<?php
    	foreach ($my_role as $key=>$value) 
    	{
    		if($usermeta==$key)
    		{
    		?>
    		<option selected="selected" value="<?php echo $key;?>"><?php echo $value;?></option>
    		<?php	
    		}
    		else 
    		{
    		?>
    		<option value="<?php echo $key;?>"><?php echo $value;?></option>
    		<?php 	
    		}
    	} 
    	?>
    </select>
    <!-- <input type="text" name="add_user_role" id="add_user_role" value="<?php echo esc_attr( get_the_author_meta( 'add_user_role', $user->ID ) ); ?>" class="regular-text" /><br /> -->
    <span class="description"><?php _e('Please Choosen User Permission.', 'your_textdomain'); ?></span>
    </td>
    </tr>
    </table>
    <?php }
    function fb_save_custom_user_profile_fields( $user_id ) {
    if ( !current_user_can( 'edit_user', $user_id ) )
    return FALSE;
    update_usermeta( $user_id, 'add_user_role', $_POST['add_user_role'] );
    }
    add_action( 'show_user_profile', 'fb_add_custom_user_profile_fields' );
    add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
    if( !is_user_logged_in() )
    	add_action( 'edit_user_profile', 'fb_add_custom_user_profile_fields' );
    add_action( 'personal_options_update', 'fb_save_custom_user_profile_fields' );
    add_action( 'edit_user_profile_update', 'fb_save_custom_user_profile_fields' );